package com.af.example;

import java.util.Random;
import java.util.concurrent.TimeUnit;

/**
 * @author : zhenyun.su
 * @comment : 提供简单加减除方法，用于测试，验证，实验新功能使用
 * @since : 2022/5/8
 */

public class AfExampleDemo extends AfBaseExample {

    public AfExampleDemo(TimeUnit timeUnit, Integer timeOut) {
        super(timeUnit, timeOut);
    }

    public static AfExampleDemo milliOf(Integer timeOut){
        return new AfExampleDemo(TimeUnit.MICROSECONDS, timeOut);
    }

    public static AfExampleDemo secondsOf(Integer timeOut){
        return new AfExampleDemo(TimeUnit.SECONDS, timeOut);
    }
    public static AfExampleDemo minutesOf(Integer timeOut){
        return new AfExampleDemo(TimeUnit.MINUTES, timeOut);
    }

    public int add(int a, int b) {
        trySleep();
        return a + b;
    }

    public int sub(int a, int b) {
        trySleep();
        return a - b;
    }

    public int divide(int a, int b) {
        trySleep();
        return a / b;
    }
}
